<style media="print">
    @page{margin-bottom:5mm;}
</style>
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="sales/cost/examine">
    <div style="font-size: 30px;text-align: center;">
        <span >费用单</span>
    </div>
    <div style="font-size: 21px; line-height:40px">
        <div style="text-align: center">
            <label>单据类型:</label>
            <span>
                {if condition="$row.source_type == 2"} 入库单 {else /} {/if}
                {if condition="$row.source_type == 7"} 出库单 {else /} {/if}
                {if condition="$row.source_type == 12"} 厂家直发 {else /} {/if}
            </span>
        </div>
        <div style="text-align: center">
            <label >单据对象:</label>
            <span>
                {if condition="$row.number_obj == 1"} 客户 {else /} {/if}
                {if condition="$row.number_obj == 2"} 供应商 {else /} {/if}
            </span>
        </div>
        <div style="text-align: center">
            <label >对象名称:</label>
            <span>{$nickname}</span>
        </div>

        <div style="text-align: center">
            <label>单据编号:</label>
            <span>{$row.source_number}</span>
        </div>
        <div style="text-align: center">
            <label>费用类型:</label>
                {volist name="types" id="vo"}
                <span value="{$key}" >{if condition="$row.type == $key"} {$vo} {else /} {/if}</span>
                {/volist}
        </div>
        <!--    <div class="form-group">-->
        <!--        <label class="control-label col-xs-12 col-sm-2">{:__('Sales_checkout_id')}:</label>-->
        <!--        <div class="col-xs-12 col-sm-8">-->
        <!--            <input id="c-sales_checkout_id" data-rule="required" data-source="sales/checkout/index" class="form-control selectpage" name="row[sales_checkout_id]" type="text" value="">-->
        <!--        </div>-->
        <!--    </div>-->
        <div style="text-align: center">
            <label >金额:</label>
            <span>{$row.cost}</span>
        </div>
        <div style="text-align: center">
            <label >是否支出:</label>
            <span>
                {if condition="$row.is_income == 1"} 收入 {else /} {/if}
                {if condition="$row.is_income == 2"} 支出 {else /} {/if}
            </span>
        </div>
        <div style="text-align: center">
            <label >{:__('Remark')}:</label>
            <span>{$row.remark}</span>
            <!--            <textarea rows="3" cols="20" class="form-control" name="remark" ></textarea>-->
        </div>
    </div>

</form>
<div class="form-group layer-footer">
    <a class="btn btn-outline-success" href="javascript:printHTML('#add-form')" target="_self" style="margin-left: 20px">打印</a>
    <!--    <a class="btn btn-outline-success  printing" href="###" target="_self" style="margin-left: 20px" >打印</a>-->
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
<script>
    function printHTML(page)
    {
        var bodyHTML=window.document.body.innerHTML;
        window.document.body.innerHTML=$(page).html();
        //设置页边距(0.6 要乘以 2.5为实际打印的尺寸)

        window.print();
        setTimeout(function () {
            window.document.body.innerHTML=bodyHTML;
        },1800)
        return false
    }
</script>